#include "Button.h"

//=====CONSTRUCTORS
Button::Button()
	:Drawable(0,0,1,1,TYPE_BUTTON,TEX_BUTTON),
	m_eiShowCondition(0),
	m_eiStateTrigger(0),
	m_bisActive(false),
	m_bWasbClicked(false),
	m_sButtonText("Button")
{}
Button::Button(float X, float Y, float scaX,float scaY, int Show, int Trigger, string Text,int ButtonType)
	:Drawable(X,Y,scaX,scaY,TYPE_BUTTON,TEX_BUTTON),
	m_eiShowCondition(Show),
	m_eiStateTrigger(Trigger),
	m_sButtonText(Text),
	m_eiButtonType(ButtonType)
{}
//=====INITIALIZE
void Button::Initialize(LPDIRECT3DTEXTURE9 T)
{
	D3DSURFACE_DESC Dimensions;
	T->GetLevelDesc(0,&Dimensions);
	float X = Dimensions.Width  * 0.5f;
	float Y = Dimensions.Height * 0.5f;
	//Chooses the location based off (Position +- (textureMeasure/2 * objectScale))
	Location.left 	= (long)(m_vecPosition.x - (X * m_vecScale.x));
	Location.right 	= (long)(m_vecPosition.x + (X * m_vecScale.x));
	Location.top 	= (long)(m_vecPosition.y - (Y * m_vecScale.y));
	Location.bottom = (long)(m_vecPosition.y + (Y * m_vecScale.y));
}

//=====ACCESSORS

bool Button::isType(int Specifier)
{
	if(m_eiButtonType == Specifier)
		return true;
	return false;
}
void Button::Update()
{
	if(m_eiShowCondition == c_eiGameState || m_eiShowCondition == GS_ALWAYS)
		m_bisActive = true;
	else 
		m_bisActive = false;
}
